package com.weasel.helper;

import java.util.*;

/**
 * Created by Dylan on 2016/1/19.
 */
public final class ArrayHelper {


    /**
     * @param array
     * @param <T>
     * @return
     */
    public static <T> List<T> arrayToList(T [] array){
        return Arrays.asList(array);
    }

    /**
     * @param array
     * @param <T>
     * @return
     */
    public static <T> Set<T> arrayToSet(T [] array){
        return new HashSet<>(arrayToList(array));
    }

    /**
     * @param set
     * @param <T>
     * @return
     */
    public static <T> List<T> setToList(Set<T> set){
        return new ArrayList<>(set);
    }

    /**
     * @param list
     * @param <T>
     * @return
     */
    public static <T> Set<T> listToSet(List<T> list){
        return new HashSet<>(list);
    }

    private ArrayHelper(){}
}
